<?php

namespace app\controllers;

use \app\common\components\BaseWebController;

use Da\QrCode\QrCode;
use yii\web\Controller;
class DefaultController extends BaseWebController
{
    public function actionIndex(){
       

        return $this->render("index");
    }
    //二维码
    public function actionQrcode(){
    	$url=$this->get('qr_code_url','');

    	if($url){
    		$qrCode = (new QrCode($url))
		    ->setSize(250)
		    ->setMargin(5);
		    $qrCode->writeFile(__DIR__ . '/code.png');
		    header('Content-Type: '.$qrCode->getContentType());
			echo $qrCode->writeString();
			exit;
    	}
    	
    }
}
